﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="EditRecipe.aspx.vb" Inherits="mybaconrecipe.EditRecipe" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1 style="margin-bottom: 0px;">
        Edit Recipe
    </h1>
    <div id="FullPaneNoBorder">
        <table cellpadding="0" cellspacing="0" class="frmTable">
            <!-- 1. RECIPE DETAILS -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        1. Recipe Details</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Recipe Name *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeName" runat="server" CssClass="textEntry"></asp:TextBox>
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_RecipeName" runat="server" ErrorMessage="You must provide the name of this recipe"
                        SetFocusOnError="True" ControlToValidate="tb_RecipeName"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Type of Recipe *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:DropDownList ID="ddl_RecipeType" runat="server" DataSourceID="SqlDataSource1"
                        DataTextField="TYPE_DESC" DataValueField="TYPE_ID" CssClass="textEntry">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT [TYPE_DESC], [TYPE_ID] FROM [TYPE]">
                    </asp:SqlDataSource>
                </td>
                <td class="val_frmTable">
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Bacon Rating *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:RadioButtonList ID="rbl_RecipeStars" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem>1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem>3</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem>5</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Rating" runat="server" ErrorMessage="You must give an initial rating to this recipe"
                        SetFocusOnError="True" ControlToValidate="rbl_RecipeStars"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Serves *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeServes" runat="server" CssClass="textEntrySm"></asp:TextBox>
                    people
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Serves" runat="server" ErrorMessage="You must state the number of people that this recipe serves"
                        SetFocusOnError="True" ControlToValidate="tb_RecipeServes"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Preparation Time *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeTime" runat="server" CssClass="textEntrySm"></asp:TextBox>
                    minutes
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Time" runat="server" ErrorMessage="You must say how long it takes to prepare this recipe"
                        SetFocusOnError="True" ControlToValidate="tb_RecipeTime"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Short Description
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeDescription" runat="server" CssClass="textEntrySm" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td class="val_frmTable">
                </td>
            </tr>
            <!-- 2. TAG RECIPE -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        2. Tag This Recipe</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Current tags
                </td>
            </tr>
            <tr>
                <td colspan="2" class="inp_frmTable">
                    <asp:TextBox ID="tb_CurrentTags" runat="server" CssClass="textEntry txtDisab"></asp:TextBox>
                    <asp:Button ID="btn_ChangeTags" runat="server" Text="Change" CssClass="btn_FormAlt" />
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_EditTags" runat="server">
                <tr>
                    <td colspan="2" class="val_frmTable" style="padding-bottom: 10px">
                        All of the above tags have been successfully removed
                    </td>
                </tr>
                <tr>
                    <td class="lbl_frmTable" colspan="2" style="padding-bottom: 10px">
                        Please choose any of our existing tags:
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="inp_frmTable">
                        <asp:CheckBoxList ID="chk_RecipeTag" runat="server" DataSourceID="tagsDataSource"
                            DataTextField="TAG" DataValueField="TAG_ID" RepeatDirection="Horizontal">
                        </asp:CheckBoxList>
                        <asp:SqlDataSource ID="tagsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT [TAG_ID], [TAG] FROM [TAG]">
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td class="lbl_frmTable">
                        Or add your own tags (separated by a comma)
                    </td>
                </tr>
                <tr>
                    <td class="inp_frmTable">
                        <asp:TextBox ID="tb_RecipeNewTags" runat="server" CssClass="textEntry"></asp:TextBox>
                    </td>
                    <td class="val_frmTable">
                    </td>
                </tr>
            </asp:PlaceHolder>
            <!-- 2. INGREDIENTS -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        3. Ingredients</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Current Ingredients
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_CurrentIngredients" runat="server">
                <tr>
                    <td>
                        <asp:GridView ID="grd_Ingredients" runat="server" AutoGenerateColumns="False" DataKeyNames="ING_ID"
                            DataSourceID="CurrIngredientsSqlDataSource" CssClass="grd_AddRecipeIngredients topBottomSpacing">
                            <Columns>
                                <asp:BoundField DataField="ING_QTY" HeaderText="ING_QTY" SortExpression="ING_QTY" />
                                <asp:BoundField DataField="ING_DESC" HeaderText="ING_DESC" SortExpression="ING_DESC" />
                            </Columns>
                            <HeaderStyle CssClass="notVis" />
                        </asp:GridView>
                        <asp:SqlDataSource ID="CurrIngredientsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [INGREDIENT] WHERE ([REC_ID] = ?)">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="REC_ID" QueryStringField="ID" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_IngredientsNew" runat="server">
                <tr>
                    <td>
                        <asp:GridView ID="grd_IngredientsNew" runat="server" AutoGenerateColumns="False"
                            DataKeyNames="ING_ID" CssClass="grd_AddRecipeIngredients topBottomSpacing">
                            <Columns>
                                <asp:BoundField DataField="ING_QTY" HeaderText="ING_QTY" SortExpression="ING_QTY" />
                                <asp:BoundField DataField="ING_DESC" HeaderText="ING_DESC" SortExpression="ING_DESC" />
                            </Columns>
                            <HeaderStyle CssClass="notVis" />
                        </asp:GridView>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <tr>
                <td>
                    <asp:Button ID="btnChangeIngredients" runat="server" Text="Change" CssClass="btn_FormAlt" />
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_EditIngredientsPt1" runat="server">
                <tr>
                    <td colspan="2" class="val_frmTable" style="padding-bottom: 10px">
                        All current ingredients have been successfully removed
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_EditIngredientsPt2" runat="server">
                <tr>
                    <td colspan="2">
                        <div class="div_Qty">
                            Quantity:
                            <asp:TextBox ID="ing_Qty" runat="server" CssClass="textEntrySm"></asp:TextBox></div>
                        <div class="div_Ing">
                            Ingredient:
                            <asp:TextBox ID="ing_Desc" runat="server" CssClass="textEntry"></asp:TextBox></div>
                        <div class="div_Btn">
                            <asp:Button ID="btn_AddToIngredients" runat="server" Text="+" CssClass="btn_FormAlt"
                                ToolTip="Press To Add Ingredient To Recipe" /></div>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <!-- 4. METHOD / COOKING INSTRUCTIONS -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        4. Cooking Instructions</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Current Cooking Instructions
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_CurrentMethods" runat="server">
                <tr>
                    <td>
                        <asp:GridView ID="grd_Method" runat="server" AutoGenerateColumns="False" DataKeyNames="METHOD_ID"
                            DataSourceID="CurrMethodsSqlDataSource" CssClass="grd_AddRecipeIngredients">
                            <Columns>
                                <asp:BoundField DataField="METHOD_DESC" HeaderText="METHOD_DESC" SortExpression="METHOD_DESC" />
                            </Columns>
                            <HeaderStyle CssClass="notVis" />
                        </asp:GridView>
                        <asp:SqlDataSource ID="CurrMethodsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [METHOD] WHERE ([REC_ID] = ?)">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="REC_ID" QueryStringField="ID" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_NewMethods" runat="server">
                <tr>
                    <td>
                        <asp:GridView ID="grd_MethodNew" runat="server" AutoGenerateColumns="False" DataKeyNames="METHOD_ID"
                            CssClass="grd_AddRecipeIngredients">
                            <Columns>
                                <asp:BoundField DataField="METHOD_DESC" HeaderText="METHOD_DESC" SortExpression="METHOD_DESC" />
                            </Columns>
                            <HeaderStyle CssClass="notVis" />
                        </asp:GridView>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <tr>
                <td>
                    <asp:Button ID="btnChangeMethods" runat="server" Text="Change" CssClass="btn_FormAlt" />
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_EditMethodsPt1" runat="server">
                <tr>
                    <td colspan="2" class="val_frmTable" style="padding-bottom: 10px">
                        All current methods have been successfully removed
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_EditMethodsPt2" runat="server">
                <tr>
                    <td colspan="2">
                        Instruction:
                        <asp:TextBox ID="meth_Desc" runat="server" CssClass="textEntry" Style="width: 463px;"></asp:TextBox>
                        <asp:Button ID="btn_AddToMethods" runat="server" Text="+" CssClass="btn_FormAlt"
                            ToolTip="Press To Add Method To Recipe" />
                    </td>
                </tr>
            </asp:PlaceHolder>


            <!-- 5. PHOTO GALLERY -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        5. Photo Gallery</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Current Photos
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_CurrentPhotos" runat="server">
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="grd_Photos" runat="server" AutoGenerateColumns="False"
                            DataSourceID="CurrPhotosSqlDataSource" CssClass="grd_AddRecipeGallery">
                        <Columns>
                            <asp:BoundField DataField="GALLERY_ID" HeaderText="" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_ID" />
                            <asp:ImageField DataImageUrlField="GALLERY_PATH" HeaderText="">
                                <ControlStyle CssClass="RecListThumb" />
                            </asp:ImageField>
                            <asp:BoundField DataField="GALLERY_SIZE" HeaderText="Size (bytes)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_SIZE" />
                            <asp:BoundField DataField="GALLERY_WIDTH" HeaderText="Width (px)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_WIDTH" />
                            <asp:BoundField DataField="GALLERY_HEIGHT" HeaderText="Height (px)" InsertVisible="False"
                                ReadOnly="False" SortExpression="GALLERY_HEIGHT" />
                        </Columns>
                        <HeaderStyle CssClass="grd_AddRecipeGalleryHeader" />
                        </asp:GridView>
                        <asp:SqlDataSource ID="CurrPhotosSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [GALLERY] WHERE ([RECIPE_ID] = ?)">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="RECIPE_ID" QueryStringField="ID" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_NewPhotos" runat="server">
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="grd_NewPhotos" runat="server" AutoGenerateColumns="False" CssClass="grd_AddRecipeGallery" AutoGenerateSelectButton="True"  SelectedRowStyle-BackColor="#DDDDDD">
                        <Columns>
                            <asp:BoundField DataField="GALLERY_ID" HeaderText="" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_ID" />
                            <asp:ImageField DataImageUrlField="GALLERY_PATH" HeaderText="">
                                <ControlStyle CssClass="RecListThumb" />
                            </asp:ImageField>
                            <asp:BoundField DataField="GALLERY_SIZE" HeaderText="Size (bytes)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_SIZE" />
                            <asp:BoundField DataField="GALLERY_WIDTH" HeaderText="Width (px)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_WIDTH" />
                            <asp:BoundField DataField="GALLERY_HEIGHT" HeaderText="Height (px)" InsertVisible="False"
                                ReadOnly="False" SortExpression="GALLERY_HEIGHT" />
                        </Columns>
                        <HeaderStyle CssClass="grd_AddRecipeGalleryHeader" />
                        </asp:GridView>
                    </td>
                </tr>
            </asp:PlaceHolder>
            <tr>
                <td>
                    <asp:Button ID="btnChangePhotos" runat="server" Text="Change" CssClass="btn_FormAlt" />
                </td>
            </tr>
            <asp:PlaceHolder ID="plc_EditPhotosPt1" runat="server">
                <tr>
                    <td colspan="2" class="val_frmTable" style="padding-bottom: 10px">
                        All current photos have been successfully removed
                    </td>
                </tr>
            </asp:PlaceHolder>
            <asp:PlaceHolder ID="plc_EditPhotosPt2" runat="server">
                <tr>
                    <td colspan="2">
                    <asp:FileUpload ID="fup_Gallery" runat="server" CssClass="textEntry" />
                    <asp:Button ID="btn_AddToGallery" runat="server" Text="+" CssClass="btn_FormAlt" />
                    </td>
                </tr>
            </asp:PlaceHolder>



            <tr>
                <td class="btn_frmTable" colspan="2">
                    <asp:Button ID="btn_CancelRecipe" runat="server" Text="Cancel" CssClass="btn_FormSecondary rightMargin" />
                    <asp:Button ID="btn_EditRecipe" runat="server" Text="Save Recipe" CssClass="btn_Form" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
